//继承模板
{extend name="public/base"}


//CSS
{block name="style"}
<link rel="stylesheet" href="__ADMIN_STATIC__/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css">
{/block}


{block name="breadcrumb" title="当前位置"}

{/block}
//正文区域
{block name="body"}{//---------------------------------------------------------------------------}
<div class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form1">
		<div id="tab-category" class="HuiTab">
			<div class="tabBar cl " style=" margin-bottom:30px;">

                <span>
                    栏目基础
                </span>
                <span>
                    栏目内容
                </span>
                <span>
                    栏目扩展
                </span>


			</div>
			<div class="tabCon" style="display:block;">

		<div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>栏目ID：</label>
            <div class="formControls col-xs-8 col-sm-8">
                {$info.id|default=""}
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>
			
		<div class="row cl">
            <label class="form-label col-xs-4 col-sm-2"><span class="c-red">*</span>栏目名称：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$info.catename|default=""}" placeholder="" name="catename" data-rule-required="true" />
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        

        

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">上级栏目：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <span class="select-box">
                <select class="select" name="pid">
                    <option value="0" >----顶级栏目----</option>
                    <?php 
                       	foreach($list as $k => $v){
                       		$selected = ( isset($info['pid']) && $info['pid'] == $v['id']) ? 'selected' : '' ;
                       		echo "<option value=\"${v['id']}\"  ${selected} >${v['_prefix']} ${v['catename']} (${v['id']}) </option>";
                    	}
                    ?>
                </select>
                </span>
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">显示&排序：</label>
            <div class="formControls col-xs-8 col-sm-8">
				<span class="select-box inline">
                <select class="select" name="display">
                    <?php 
                       	foreach(array( 1 => '显示' , -1 => '隐藏') as $k => $v){
                       		$selected = (  $info['display'] == $k ) ? 'selected' : '' ;
                       		echo "<option value=\"${k}\"  ${selected} >${v}</option>";
                    	}
                    ?>
                </select>
                </span>

                   &nbsp;&nbsp;&nbsp;&nbsp; 
                排序：
                <input type="text" class="input-text" value="{$info.sort|default="50"}" name="sort"  style="text-align:center; width:50px;" >
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">栏目类型：</label>
            <div class="formControls col-xs-8 col-sm-8">
				<span class="select-box inline">
                <select class="select" name="type">
            	<?php 
                       	foreach(array( 'index' => '栏目封面 (index)' , 'list' => '栏目列表 (list)' ,'url'=>'跳转地址 (url)' ) as $k => $v){
                       		$selected = (  $info['type'] == $k ) ? 'selected' : '' ;
                       		echo "<option value=\"${k}\"  ${selected} >${v}</option>";
                    	}
                ?>
                </select>
                </span>

            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">跳转地址：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$info.jumpurl|default=""}" placeholder="" name="jumpurl"  />
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>


        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">关键字：<br/>  <input type="checkbox" name="auto_keywords" checked />自动获取&nbsp;</label>
            <div class="formControls col-xs-8 col-sm-8">
               <textarea name="keywords" class="textarea" placeholder="关键字用‘英文逗号’分隔">{$info.keywords|default=""}</textarea>
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">描述：<br/>  <input type="checkbox" name="auto_description" checked />自动获取&nbsp;</label>
            <div class="formControls col-xs-8 col-sm-8">
                <textarea name="description" class="textarea" placeholder="写点什么。。。">{$info.description|default=""}</textarea>
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>
                <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">封面模板：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$info.temp_index|default=""}" placeholder="" name="temp_index"  />
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">列表模板：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$info.temp_list|default=""}" placeholder="" name="temp_list"  />
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">内容模板：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$info.temp_art|default=""}" placeholder="" name="temp_art"  />
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

			</div>


			<div class="tabCon">
		<div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">seotitle：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <input type="text" class="input-text" value="{$info.seoname|default=""}" placeholder="" name="seoname"/>
                
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">栏目图片：</label>
            <div class="formControls col-xs-8 col-sm-8">
		        <div kindeditor="uploadpic" >
		        	<img src="{$info.litpic|default=""}" KEimg style="max-width:100px; max-height:100px;" >
		            <input type="hidden" name="litpic" value="{$info.litpic|default=""}" KEipt/>
		            <button class="btn btn-secondary radius" type="button" KEbtn><i class="Hui-iconfont Hui-iconfont-picture"></i> 图片上传 </button>
		        </div>
            </div>
            <div class="formControls col-xs-8 col-sm-2">
            </div>
        </div>

        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-2">栏目正文：</label>
            <div class="formControls col-xs-8 col-sm-8">
                <textarea name="content" kindeditor style="width:100%;height:400px;visibility:hidden;">{$info.content|default=""}</textarea>
            </div>
        </div>

			</div>


			<div class="tabCon">
				栏目扩展暂无...
			</div>
		</div>

		<div class="row cl">
            <div class="col-xs-8 col-sm-5 col-xs-offset-4 col-sm-offset-2">
                <input type="hidden" name="id"  value="{$info.id|default="0"}"/>
                <button class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交 </button>

                <button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>

	</form>
</div>
{/block}
//-----------------------------------------------------------------------------------------------


<!--请在下方写此页面业务相关的脚本-->
//-----------------------------------------------------------------------------------------------
{block name="script"}
<script type="text/javascript" src="__ADMIN_STATIC__/lib/zTree/v3/js/jquery.ztree.all-3.5.min.js"></script> 
<script type="text/javascript">


$(function(){
	
	$("#tab-category").Huitab({
		index:0
	});

	//返回顶部
	$.Huitotop();

	//表单验证 提交
	$('#form1').validate({
		onkeyup:false, //在 keyup 时验证。
        onclick:true, // 在点击复选框和单选按钮时验证。
        onfocusout:false, //失去焦点时验证（不包括复选框/单选按钮）。
        onsubmit:true ,   // 提交时验证。设置为 false 就用其他方法去验证。
		focusCleanup:true,focusInvalid:false,
		//success:"valid", //验证成功 添加样式
		rules: {

      	},
		submitHandler:function(form){
            jBox.tip('loading...' , 'loading') ; 

            var $form  = $("form");
            var url = $form.attr('action');
            var type = $form.attr('method') || 'get';
            var data = $form.serialize();
            $.ajax({
            	url: url ,
            	type:type , // get post
            	data: data , 
            	dataType : 'html' ,
            	success:function(d){
            		try{d = JSON.parse(d);}catch(err){jBox.alert( d , '查看ajax返回值');return false;}
				    if( 0 == d.ret){
				    	jBox.tip( d.msg , 'success');
				    	setTimeout(function(){window.parent.location.reload();},2000);
				    }else{
				    	jBox.tip( d.msg , 'error');
				    }
            	},
            	error:function(XMLHttpRequest, textStatus, errorThrown){
            		console.log( 'ajaxError : ' + textStatus );
            	},
            	complete:function(){
            		setTimeout(function(){jBox.closeTip();},3000);
            	}
            });
			// parent.$('.btn-refresh').click();
			// var index = parent.layer.getFrameIndex(window.name);
			// parent.layer.close(index);
		},
		showErrors:function(errorMap,errorList) {
			this.defaultShowErrors(); //默认验证 
			if( this.numberOfInvalids() ){
				jBox.tip( '有' + this.numberOfInvalids() + '个错误，请检查！' ,'error');
			}
    	}
	});
});//$(function(){


</script>

<style>
	

	
</style>



{/block}{//---------------------------------------------------------------------------}